package com.atguigu.c_designed.m3beheviorModel.b9Delegate;

import java.util.HashMap;
import java.util.Map;

public class DelegateManager implements TaskEmployee{
    private Map<String, TaskEmployee> employee = new HashMap<>();

    public DelegateManager() {
        employee.put("网络爬虫", new ConcreteTaskEmployeeA());
        employee.put("海报图", new ConcreteTaskEmployeeB());
    }

    @Override
    public void doTask(String task) {
        if (!employee.containsKey(task)) {
            System.out.println("这个任务" + task + "超出我的能力范围");
            return;
        }
        employee.get(task).doTask(task);
    }
}
